String.prototype.format = function (fmt) {
    if (!fmt || fmt === {}) {
        return this;
    }
    let string = this;
    for (const key in fmt) {
        string = string.replace(new RegExp("\\{" + key + "\\}", "g"), fmt[key])
    }
    return string;
};
String.prototype.toJSON = function () {
    try {
        return JSON.parse(this);
    } catch (e) {
        console.error("string is must be a json string")
        return {};
    }
};
import pinyin from './convert-pinyin.js'
String.prototype.toPinYin = function () {
    return pinyin.getFullChars(this);
};

export default {
    init() {
        console.log("*** string installed ***")
    }
}
